package item;

import loadsave.Memento;
import loadsave.loadsaveobject.LoadSaveObject;
import loadsave.loadsaveobject.LoadSaveObjectComposite;
import loadsave.loadsaveobject.LoadSavePrimitive;

public abstract class Item extends model.ModelObject implements Cloneable {

	/**
	 * For loading using Mementos
	 */
	public Item() { }
	
    public Item( String name ) { 
        super(name);
    }
    
    public abstract void accept( visitors.ItemVisitor iv );
    
    /**
     * defines if this item can be walked on.
     * default for all subclasses is true
     * @return
     */
    public boolean canBeWalkedOn() {
        return true;
    }
    
    @Override
    public Memento getMemento() {
        return new Memento() {

			@Override
			public LoadSaveObject getState() {
				LoadSaveObject toReturn = Item.super.getMemento().getState();
				toReturn.setType("Item");
				return toReturn;
			}

			@Override
			public void restoreState(LoadSaveObject lso) {
				Item.super.getMemento().restoreState(lso);
			}
        	
        };
    }
    
    /**
     * return a clone of this item
     */
    public abstract Item clone();
}
